<!DOCTYPE html>
<?php
session_start();
?>
<html>
    <head>
        <meta http-equiv="refresh" content="100000;" /> 
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="style.css"/>
    </head>
    <body>
        <?php
        include('functions.php');
        include('header.php');
        if (coUser() && isAdmin()) {
            ?>

            <div class="sectionAdmin">
                <a href="admin.php?edit=create">Création d'un article</a><br/>
                <a href="admin.php?edit=modif">Modification des articles</a><br/>
                <a href="admin.php?edit=usr">Gestion des utilisateurs</a><br/>
                <a href="admin.php?edit=cat">Gestion des catégories</a><br/>
            </div>
            <?php
            if (isset($_GET['edit'])) {
                switch ($_GET['edit']) {
                    case "create":
                        //creation d'un article
                        include('article.php');
                        break;
                    case "modif":
                        if (isset($_GET['suppr'])) {
                            // suppression d'un article
                            supprArticle($_GET['suppr']);
                            include('modif.php');
                        } else {
                            if (isset($_GET['modif'])) {
                                // modification d'un article
                                include('articleEdit.php');
                            } else {
                                include('modif.php');
                            }
                        }
                        break;
                    case "usr":
                        include('user.php');
                        break;
                    case "cat":
                        echo "cat";
                        break;
                }
            }
        } else {
            echo 'You don\'t have permission';
        }
        ?>

    </body>
</html>